package File;

import java.io.*;

public class Demo12 {
    public static void main(String[] args) throws FileNotFoundException {
        File file = new File("test.txt");
        try(InputStream inputStream = new FileInputStream(file)) {
            while (true) {
                byte[] data = new byte[1024];
                int n = inputStream.read(data);
                if (n == -1) {
                    break;
                }
                for (int i = 0; i < n; i++) {
//                    System.out.printf("0x%x\n", data[i]);
//                    System.out.println(data[i]);
                    System.out.print((char)data[i]);
                }
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
